#Coded By Ionescu Andrei and Pogoreanu Rares
#Hunger Games

agresivity=0.5
pl=0
rep=0
health=100
food=300
def hunt_choices(round_number, current_food, current_reputation, m, 
            player_reputations):
    global pl
    pl=0
    global agresivity
    global food
    global health
    food=current_food
    rep=current_reputation
    hunt_decisions = list()
   
    if round_number<2:
        count=0
        for x in player_reputations:
           hunt_decisions.append('s' if count%3==0 else 'h')
           count += 1
           pl += 1
    else:
        count=0
        for x in player_reputations:
            count += 1
            pl += 1
            if (health>(current_food/1.6)):
                if (x>agresivity and current_reputation<0.87):
                    hunt_decisions.append('h')
                else:
                    hunt_decisions.append('s')
            else:
                if (x>0.89 and current_reputation>0.78 and count%2==0):
                    hunt_decisions.append('s')
                else:
                    if (x>(agresivity+0.05) and current_reputation<0.68):
                       hunt_decisions.append('h')
                    else:
                       hunt_decisions.append('s')
    
    if current_food<100*pl:
        agresivity+=0.1
    elif current_food>300*pl:
        agresivity-=0.1
        
    return hunt_decisions

def hunt_outcomes(food_earnings):
    winloss=0
    global agresivity
    global pl
    global health
    global food
    for y in food_earnings:
        winloss+=y
    if (winloss>(pl/2)):
        agresivity-=0.01
    elif winloss<(-pl):
        agresivity+=0.05
    if agresivity < 0.2:
        agresivity=0.2
    elif agresivity > 0.86:
        agresivity=0.86
        if (food>100*pl):
            agresivity-=rep/2
        elif (food>50*pl):
            agresivity-=rep/4
    health=food+(winloss*100)
    if health<food/2:
        agresivity+=0.06
    elif health>food/1.6:
        agresivity-=0.06

def round_end(award, m, number_hunters):
    if number_hunters<((pl**pl)/2):
        aresivity+=0.1
